package com.china08.yxyapi.api.manage.edu.platform.slider;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.repository.mg.YxyHomeSliderRepository;

import io.swagger.annotations.ApiOperation;

/**
 * 教育局平台办公 焦点图管理 删除
 * 
 */
@CrossOrigin
@RestController
public class SliderDelController extends YxyApiBaseController {

    @Autowired
    private YxyHomeSliderRepository yhsr;

    @ApiOperation(value = "教育局 删除焦点图")
    @RequestMapping(value = "/api_yw/manage/edu/platform/slider/delete/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespModel precess(@PathVariable(value = "id") String id, HttpServletRequest request,
            HttpServletResponse response) {
        RespModel model = new RespModel();
        String eduId = getProfile(request, response).getSchoolId();
        String sliderId = id;
        yhsr.deleteByIdAndEdbId(sliderId, eduId);
        model.setMessage("成功");
        return model;
    }

    protected static class RespModel extends YxyApiRespModel {

    }
}